<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <canvas id="canvas"></canvas>
    <script>
        var canvas = document.getElementById('canvas')
        var context = canvas.getContext('2d')
        context.fillRect(50, 50, 100, 100)  // 实心矩形
        context.strokeRect(120, 10, 100, 100) // 空心矩形
        context.fillStyle = 'pink' // 设置颜色
        context.strokeStyle = 'pink'
        context.fillRect(0, 0, 100, 100)  // 实心矩形
        context.strokeRect(120, 0, 100, 100) // 空心矩形
    </script>
</body>
</html>